﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>winjstk-isconnected</title>

	<!-- WinJS references -->
	<link href="//Microsoft.WinJS.2.0/css/ui-dark.css" rel="stylesheet" />
	<script src="//Microsoft.WinJS.2.0/js/base.js"></script>
	<script src="//Microsoft.WinJS.2.0/js/ui.js"></script>

	<link href="winjstk-isconnected.css" rel="stylesheet" />
	<script src="winjstk-isconnected.js"></script>
</head>
<body>
	<div class="description-page fragment">
		<header aria-label="Header content" role="banner">
			<button class="win-backbutton" aria-label="Back" disabled type="button"></button>
			<h1 class="titlearea win-type-ellipsis">
				<span class="pagetitle">WinJSTK.isConnected()</span>
			</h1>
		</header>

		<section aria-label="Main content" role="main">
			<p>
				The WinJS Toolkit provides the <strong>WinJSTK.isConnected()</strong> function that you can use to detect whether the device has internet connection.
			</p>
			
		
			<h2>Usage</h2>
			
			<h3>Parameters</h3>
			<p>
				None.
			</p>
			
			<h3>Returns</h3>
			<p>
				A Boolean value that is True, if the device connects to the internet, otherwise false.
			</p>

			<h3>Example</h3>
			<pre>
if( WinJSTK.isConnected() )
{
	<em>// Do something that requires network connection here...</em>
}
			</pre>
			

			<h2>Live demo</h2>
			
			<p>
				<span id="spResult"></span>
			</p>
			

			<h2>Live demo source code</h2>
			
			<h3>The HTML page</h3>
			<pre>
&lt;span id="spResult"&gt;&lt;/span&gt;
</pre>
			
			<h3>The JavaScript code</h3>
			<pre>
var spResult = document.getElementById( 'spResult' );
spResult.innerHTML = WinJSTK.isConnected() ? 'Your device is now connected to the internet.' : 'Your device has currently no internet connection';
</pre>
		</section>
	</div>
</body>
</html>
